classdef YinyeyingCalc < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure             matlab.ui.Figure
        PhysTotalCost        matlab.ui.control.TextArea
        Label_29             matlab.ui.control.Label
        DateFinished         matlab.ui.control.TextArea
        Label_27             matlab.ui.control.Label
        DaysCost             matlab.ui.control.TextArea
        Label_26             matlab.ui.control.Label
        PhysTotal            matlab.ui.control.TextArea
        Label_25             matlab.ui.control.Label
        V10Label             matlab.ui.control.Label
        StoneGap             matlab.ui.control.TextArea
        Label_23             matlab.ui.control.Label
        GatherGap            matlab.ui.control.TextArea
        Label_22             matlab.ui.control.Label
        FishingGap           matlab.ui.control.TextArea
        Label_21             matlab.ui.control.Label
        WashingGap           matlab.ui.control.TextArea
        Label_20             matlab.ui.control.Label
        CatchGap             matlab.ui.control.TextArea
        Label_19             matlab.ui.control.Label
        CatchPhysGap         matlab.ui.control.TextArea
        Drgnum_2             matlab.ui.control.Spinner
        Label_18             matlab.ui.control.Label
        Drgnum               matlab.ui.control.Spinner
        Label_17             matlab.ui.control.Label
        Stonegoal            matlab.ui.control.NumericEditField
        Label_16             matlab.ui.control.Label
        Gathergoal           matlab.ui.control.DropDown
        Label_15             matlab.ui.control.Label
        Fishinggoal          matlab.ui.control.DropDown
        Label_14             matlab.ui.control.Label
        Washinggoal          matlab.ui.control.DropDown
        Label_13             matlab.ui.control.Label
        Insect_catchinggoal  matlab.ui.control.DropDown
        Label_12             matlab.ui.control.Label
        datedisplay          matlab.ui.control.TextArea
        Label_11             matlab.ui.control.Label
        Stone                matlab.ui.control.NumericEditField
        Label_10             matlab.ui.control.Label
        Gather               matlab.ui.control.NumericEditField
        Label_9              matlab.ui.control.Label
        Fishing              matlab.ui.control.NumericEditField
        EditField_3Label     matlab.ui.control.Label
        Washing              matlab.ui.control.NumericEditField
        EditField_2Label     matlab.ui.control.Label
        Insect_catching      matlab.ui.control.NumericEditField
        Label_8              matlab.ui.control.Label
        StonePhysGap         matlab.ui.control.TextArea
        Label_7              matlab.ui.control.Label
        Label_6              matlab.ui.control.Label
        GatherPhysGap        matlab.ui.control.TextArea
        FishingPhysGap       matlab.ui.control.TextArea
        WashingPhysGap       matlab.ui.control.TextArea
        Panel                matlab.ui.container.Panel
        Button_2             matlab.ui.control.Button
        Button               matlab.ui.control.Button
        CostB                matlab.ui.control.NumericEditField
        EditField_2Label_2   matlab.ui.control.Label
        CostA                matlab.ui.control.NumericEditField
        Label_24             matlab.ui.control.Label
        Weekly60             matlab.ui.control.CheckBox
        Label_5              matlab.ui.control.Label
        PhysicalGet          matlab.ui.container.ButtonGroup
        Daily428             matlab.ui.control.RadioButton
        Daily368             matlab.ui.control.RadioButton
        Daily348             matlab.ui.control.RadioButton
        Daily288             matlab.ui.control.RadioButton
        Label_4              matlab.ui.control.Label
        Onekeygoal430        matlab.ui.control.CheckBox
        Label_3              matlab.ui.control.Label
        Label_2              matlab.ui.control.Label
        Label                matlab.ui.control.Label
        Calculate            matlab.ui.control.Button
    end

    
    properties (Access = private)
        Gathernum int16
        Fishingnum int16
        Washingnum int16
        Insect_catchingnum int16
        Stonenum int16
        Gathergoalnum int16
        Fishinggoalnum int16
        Washinggoalnum int16
        Insect_catchinggoalnum int16
        Stonegoalnum int16
        Drgcnt int16
        Physical int16
        PhysicalDaily int16
        Diamondnum int16
        Weekly int16
        CostAnum int16
        CostBnum int16
        GatherGapnum int16
        FishingGapnum int16
        WashingGapnum int16
        Insect_catchingGapnum int16
        GatherPhysGapnum int16
        FishingPhysGapnum int16
        WashingPhysGapnum int16
        Insect_catchingPhysGapnum int16
        StoneGapnum int16
        StonePhysGapnum int16
        PhysTotalnum int16
        DaysCostnum int16
        PhysTotalCostnum int16
        Costunit int16
    end
    

    % Callbacks that handle component events
    methods (Access = private)

        % Code that executes after component creation
        function startupFcn(app)
            date=datetime("now",'Format','yyyy-MM-dd');
            app.datedisplay.Value=string(date);
            app.Gathernum = 0;
            app.Fishingnum = 0;
            app.Washingnum = 0;
            app.Insect_catchingnum = 0;
            app.Stonenum = 0;
            app.Gathergoalnum = 18000;
            app.Fishinggoalnum = 18000;
            app.Washinggoalnum = 18000;
            app.Insect_catchinggoalnum = 7000;
            app.Stonegoalnum = 430;
            app.Drgcnt = 0;
            app.Physical = 0;
            app.PhysicalDaily = 288;
            app.Diamondnum = 0;
            app.Weekly = 0;
            app.CostAnum = 0;
            app.CostBnum = 0;
            app.DaysCostnum = 0;
            app.PhysTotalCostnum = 0;
        end

        % Button pushed function: Calculate
        function CalculatePushed(app, event)
            app.Insect_catchingGapnum=max(app.Insect_catchinggoalnum-app.Insect_catchingnum,0);
            app.CatchGap.Value = string(app.Insect_catchingGapnum);
            app.WashingGapnum=max(app.Washinggoalnum-app.Washingnum,0);
            app.WashingGap.Value = string(app.WashingGapnum); 
            app.FishingGapnum = max(app.Fishinggoalnum - app.Fishingnum, 0);
            app.FishingGap.Value = string(app.FishingGapnum);
            app.GatherGapnum = max(app.Gathergoalnum - app.Gathernum, 0);
            app.GatherGap.Value = string(app.GatherGapnum);

            app.Insect_catchingPhysGapnum = ceil(double(app.Insect_catchingGapnum) / 200) * 20;
            app.CatchPhysGap.Value = string(app.Insect_catchingPhysGapnum);
            app.WashingPhysGapnum = ceil(double(app.WashingGapnum) / 200) * 20;
            app.WashingPhysGap.Value = string(app.WashingPhysGapnum);
            app.FishingPhysGapnum = ceil(double(app.FishingGapnum) / 200) * 20;
            app.FishingPhysGap.Value = string(app.FishingPhysGapnum);
            app.GatherPhysGapnum = ceil(double(app.GatherGapnum) / 200) * 20;
            app.GatherPhysGap.Value = string(app.GatherPhysGapnum);


            app.StoneGapnum = max(app.Stonegoalnum - app.Stonenum, 0);
            app.StoneGap.Value = string(app.StoneGapnum);
        
            app.StonePhysGapnum = ceil(double(app.StoneGapnum) / 5) * 40;
            app.StonePhysGap.Value = string(app.StonePhysGapnum);

            app.PhysTotalnum = app.Insect_catchingPhysGapnum + app.WashingPhysGapnum + app.FishingPhysGapnum + app.GatherPhysGapnum + app.StonePhysGapnum;
            app.PhysTotal.Value = string(app.PhysTotalnum);
            app.DaysCostnum = 0;
            app.PhysTotalCostnum = 0;
            app.Physical = 0;
            app.Physical=app.Physical+app.Drgcnt*80;
            PhysicalDailyTotal=app.PhysicalDaily+app.Diamondnum*0.8;
            Today=datetime("now",'Format','yyyy-MM-dd');
            app.Costunit=0;
            while(app.PhysTotalnum>0)
                if(PhysicalDailyTotal<app.CostAnum+app.CostBnum || app.DaysCostnum> 10000)
                    break;
                end
                app.DaysCostnum = app.DaysCostnum +1;
                Today = Today + days(1);
                app.Physical=app.Physical+PhysicalDailyTotal;
                if(day(Today,'dayofweek')==2 && app.Weekly==1)
                    app.Physical=app.Physical-60;
                    app.PhysTotalCostnum=app.PhysTotalCostnum+60;
                end
                app.Physical=app.Physical-app.CostAnum-app.CostBnum;
                app.PhysTotalCostnum=app.PhysTotalCostnum+app.CostAnum+app.CostBnum;

                app.Costunit=floor(app.Physical/20);
                app.Physical=app.Physical-20*app.Costunit;
                app.PhysTotalnum=app.PhysTotalnum-20*app.Costunit;
                app.PhysTotalCostnum=app.PhysTotalCostnum+20*app.Costunit;
            end
            if(PhysicalDailyTotal<app.CostAnum+app.CostBnum || app.DaysCostnum> 10000)
                    app.DaysCost.Value="数值异常";
                    app.DateFinished.Value="";
                    app.PhysTotalCost.Value="";
            else
            app.DaysCost.Value=string(app.DaysCostnum);
            app.DateFinished.Value=string(Today);
            app.PhysTotalCost.Value=string(app.PhysTotalCostnum);
            end
        end

        % Value changed function: Insect_catchinggoal
        function Insect_catchinggoalValueChanged(app, event)
            value = app.Insect_catchinggoal.Value;
            app.Insect_catchinggoalnum=str2num(value);
        end

        % Value changed function: Washinggoal
        function WashinggoalValueChanged(app, event)
            value = app.Washinggoal.Value;
            app.Washinggoalnum=str2num(value);
        end

        % Value changed function: Fishinggoal
        function FishinggoalValueChanged(app, event)
            value = app.Fishinggoal.Value;
            app.Fishinggoalnum=str2num(value);
        end

        % Value changed function: Gathergoal
        function GathergoalValueChanged(app, event)
            value = app.Gathergoal.Value;
            app.Gathergoalnum=str2num(value);
        end

        % Value changed function: Onekeygoal430
        function Onekeygoal430ValueChanged(app, event)
            value = app.Onekeygoal430.Value;
            if value == 1
                app.Stonegoal.Value=430;
                app.Stonegoalnum=430;
            end
        end

        % Value changed function: Drgnum
        function DrgnumValueChanged(app, event)
            value = app.Drgnum.Value;
            app.Drgcnt=value;
        end

        % Selection changed function: PhysicalGet
        function PhysicalGetSelectionChanged(app, event)
            selectedButton = app.PhysicalGet.SelectedObject;
            switch selectedButton.Text
                case '自回体'
                    app.PhysicalDaily=288;
                case '周卡'
                    app.PhysicalDaily=348;
                case '50钻'
                    app.PhysicalDaily=368;
                case '周卡+50钻'
                    app.PhysicalDaily=428;
            end
        end

        % Value changed function: Drgnum_2
        function Drgnum_2ValueChanged(app, event)
            value = app.Drgnum_2.Value;
            app.Diamondnum=value;
        end

        % Value changed function: Insect_catching
        function Insect_catchingValueChanged(app, event)
            value = app.Insect_catching.Value;
            app.Insect_catchingnum=value;
        end

        % Value changed function: Washing
        function WashingValueChanged(app, event)
            value = app.Washing.Value;
            app.Washingnum=value;
        end

        % Value changed function: Fishing
        function FishingValueChanged(app, event)
            value = app.Fishing.Value;
            app.Fishingnum=value;
        end

        % Value changed function: Gather
        function GatherValueChanged(app, event)
            value = app.Gather.Value;
            app.Gathernum=value;
        end

        % Value changed function: Stone
        function StoneValueChanged(app, event)
            value = app.Stone.Value;
            app.Stonenum=value;
        end

        % Value changed function: Stonegoal
        function StonegoalValueChanged(app, event)
            value = app.Stonegoal.Value;
            app.Stonegoalnum=value;
        end

        % Value changed function: Weekly60
        function Weekly60ValueChanged(app, event)
            value = app.Weekly60.Value;
            app.Weekly=value;
        end

        % Value changed function: CostA
        function CostAValueChanged(app, event)
            value = app.CostA.Value;
            app.CostAnum = value;
        end

        % Value changed function: CostB
        function CostBValueChanged(app, event)
            value = app.CostB.Value;
            app.CostBnum = value;
        end

        % Button pushed function: Button
        function CostAnumToZeroValueChanged(app, event)
            app.CostA.Value=0;
            app.CostAnum=0;
        end

        % Button pushed function: Button_2
        function CostBnumToZeroValueChanged(app, event)
            app.CostB.Value=0;
            app.CostBnum=0;
        end
    end

    % Component initialization
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Create UIFigure and hide until all components are created
            app.UIFigure = uifigure('Visible', 'off');
            app.UIFigure.Position = [100 100 846 531];
            app.UIFigure.Name = 'MATLAB App';
            app.UIFigure.Resize = 'off';

            % Create Calculate
            app.Calculate = uibutton(app.UIFigure, 'push');
            app.Calculate.ButtonPushedFcn = createCallbackFcn(app, @CalculatePushed, true);
            app.Calculate.FontSize = 18;
            app.Calculate.Position = [61 14 100 30];
            app.Calculate.Text = '计算';

            % Create Label
            app.Label = uilabel(app.UIFigure);
            app.Label.FontSize = 24;
            app.Label.Position = [27 414 149 32];
            app.Label.Text = '四种心得数量';

            % Create Label_2
            app.Label_2 = uilabel(app.UIFigure);
            app.Label_2.FontSize = 24;
            app.Label_2.Position = [30 195 101 32];
            app.Label_2.Text = '石头数量';

            % Create Label_3
            app.Label_3 = uilabel(app.UIFigure);
            app.Label_3.FontSize = 24;
            app.Label_3.Position = [217 414 101 32];
            app.Label_3.Text = '目标设定';

            % Create Onekeygoal430
            app.Onekeygoal430 = uicheckbox(app.UIFigure);
            app.Onekeygoal430.ValueChangedFcn = createCallbackFcn(app, @Onekeygoal430ValueChanged, true);
            app.Onekeygoal430.Text = '设置石头目标为430';
            app.Onekeygoal430.Position = [48 53 126 22];

            % Create Label_4
            app.Label_4 = uilabel(app.UIFigure);
            app.Label_4.FontSize = 24;
            app.Label_4.Position = [409 414 173 32];
            app.Label_4.Text = '体力获得与消耗';

            % Create PhysicalGet
            app.PhysicalGet = uibuttongroup(app.UIFigure);
            app.PhysicalGet.SelectionChangedFcn = createCallbackFcn(app, @PhysicalGetSelectionChanged, true);
            app.PhysicalGet.Title = '体力每日获得';
            app.PhysicalGet.FontSize = 18;
            app.PhysicalGet.Position = [421 274 149 129];

            % Create Daily288
            app.Daily288 = uiradiobutton(app.PhysicalGet);
            app.Daily288.Text = '自回体';
            app.Daily288.Position = [9 71 58 22];
            app.Daily288.Value = true;

            % Create Daily348
            app.Daily348 = uiradiobutton(app.PhysicalGet);
            app.Daily348.Text = '周卡';
            app.Daily348.Position = [9 49 65 22];

            % Create Daily368
            app.Daily368 = uiradiobutton(app.PhysicalGet);
            app.Daily368.Text = '50钻';
            app.Daily368.Position = [9 27 65 22];

            % Create Daily428
            app.Daily428 = uiradiobutton(app.PhysicalGet);
            app.Daily428.Text = '周卡+50钻';
            app.Daily428.Position = [9 6 78 22];

            % Create Label_5
            app.Label_5 = uilabel(app.UIFigure);
            app.Label_5.FontSize = 24;
            app.Label_5.Position = [626 414 101 32];
            app.Label_5.Text = '计算结果';

            % Create Panel
            app.Panel = uipanel(app.UIFigure);
            app.Panel.Title = '每日体力消耗';
            app.Panel.FontSize = 18;
            app.Panel.Position = [217 24 365 143];

            % Create Weekly60
            app.Weekly60 = uicheckbox(app.Panel);
            app.Weekly60.ValueChangedFcn = createCallbackFcn(app, @Weekly60ValueChanged, true);
            app.Weekly60.Text = '每周一打周本';
            app.Weekly60.Position = [20 83 94 22];

            % Create Label_24
            app.Label_24 = uilabel(app.Panel);
            app.Label_24.HorizontalAlignment = 'right';
            app.Label_24.Position = [3 51 125 22];
            app.Label_24.Text = '每日素材激化消耗体力';

            % Create CostA
            app.CostA = uieditfield(app.Panel, 'numeric');
            app.CostA.ValueDisplayFormat = '%.0f';
            app.CostA.ValueChangedFcn = createCallbackFcn(app, @CostAValueChanged, true);
            app.CostA.Position = [143 51 100 22];

            % Create EditField_2Label_2
            app.EditField_2Label_2 = uilabel(app.Panel);
            app.EditField_2Label_2.HorizontalAlignment = 'right';
            app.EditField_2Label_2.Position = [27 18 101 22];
            app.EditField_2Label_2.Text = '每日杂项消耗体力';

            % Create CostB
            app.CostB = uieditfield(app.Panel, 'numeric');
            app.CostB.ValueDisplayFormat = '%.0f';
            app.CostB.ValueChangedFcn = createCallbackFcn(app, @CostBValueChanged, true);
            app.CostB.Position = [143 18 100 22];

            % Create Button
            app.Button = uibutton(app.Panel, 'push');
            app.Button.ButtonPushedFcn = createCallbackFcn(app, @CostAnumToZeroValueChanged, true);
            app.Button.Position = [275 50 66 23];
            app.Button.Text = '清空';

            % Create Button_2
            app.Button_2 = uibutton(app.Panel, 'push');
            app.Button_2.ButtonPushedFcn = createCallbackFcn(app, @CostBnumToZeroValueChanged, true);
            app.Button_2.Position = [275 17 66 23];
            app.Button_2.Text = '清空';

            % Create WashingPhysGap
            app.WashingPhysGap = uitextarea(app.UIFigure);
            app.WashingPhysGap.Editable = 'off';
            app.WashingPhysGap.Position = [742 320 75 25];

            % Create FishingPhysGap
            app.FishingPhysGap = uitextarea(app.UIFigure);
            app.FishingPhysGap.Editable = 'off';
            app.FishingPhysGap.Position = [742 288 75 25];

            % Create GatherPhysGap
            app.GatherPhysGap = uitextarea(app.UIFigure);
            app.GatherPhysGap.Editable = 'off';
            app.GatherPhysGap.Position = [742 255 75 25];

            % Create Label_6
            app.Label_6 = uilabel(app.UIFigure);
            app.Label_6.Position = [677 381 29 22];
            app.Label_6.Text = '差值';

            % Create Label_7
            app.Label_7 = uilabel(app.UIFigure);
            app.Label_7.Position = [753 381 53 22];
            app.Label_7.Text = '所需体力';

            % Create StonePhysGap
            app.StonePhysGap = uitextarea(app.UIFigure);
            app.StonePhysGap.Editable = 'off';
            app.StonePhysGap.Position = [742 221 75 25];

            % Create Label_8
            app.Label_8 = uilabel(app.UIFigure);
            app.Label_8.HorizontalAlignment = 'right';
            app.Label_8.Position = [30 374 29 22];
            app.Label_8.Text = '捕虫';

            % Create Insect_catching
            app.Insect_catching = uieditfield(app.UIFigure, 'numeric');
            app.Insect_catching.ValueDisplayFormat = '%.0f';
            app.Insect_catching.ValueChangedFcn = createCallbackFcn(app, @Insect_catchingValueChanged, true);
            app.Insect_catching.Position = [74 374 100 22];

            % Create EditField_2Label
            app.EditField_2Label = uilabel(app.UIFigure);
            app.EditField_2Label.HorizontalAlignment = 'right';
            app.EditField_2Label.Position = [30 333 29 22];
            app.EditField_2Label.Text = '清洁';

            % Create Washing
            app.Washing = uieditfield(app.UIFigure, 'numeric');
            app.Washing.ValueDisplayFormat = '%.0f';
            app.Washing.ValueChangedFcn = createCallbackFcn(app, @WashingValueChanged, true);
            app.Washing.Position = [74 333 100 22];

            % Create EditField_3Label
            app.EditField_3Label = uilabel(app.UIFigure);
            app.EditField_3Label.HorizontalAlignment = 'right';
            app.EditField_3Label.Position = [30 291 29 22];
            app.EditField_3Label.Text = '钓鱼';

            % Create Fishing
            app.Fishing = uieditfield(app.UIFigure, 'numeric');
            app.Fishing.ValueDisplayFormat = '%.0f';
            app.Fishing.ValueChangedFcn = createCallbackFcn(app, @FishingValueChanged, true);
            app.Fishing.Position = [74 291 100 22];

            % Create Label_9
            app.Label_9 = uilabel(app.UIFigure);
            app.Label_9.HorizontalAlignment = 'right';
            app.Label_9.Position = [30 246 29 22];
            app.Label_9.Text = '采集';

            % Create Gather
            app.Gather = uieditfield(app.UIFigure, 'numeric');
            app.Gather.ValueDisplayFormat = '%.0f';
            app.Gather.ValueChangedFcn = createCallbackFcn(app, @GatherValueChanged, true);
            app.Gather.Position = [74 246 100 22];

            % Create Label_10
            app.Label_10 = uilabel(app.UIFigure);
            app.Label_10.HorizontalAlignment = 'right';
            app.Label_10.Position = [30 145 29 22];
            app.Label_10.Text = '石头';

            % Create Stone
            app.Stone = uieditfield(app.UIFigure, 'numeric');
            app.Stone.ValueDisplayFormat = '%.0f';
            app.Stone.ValueChangedFcn = createCallbackFcn(app, @StoneValueChanged, true);
            app.Stone.Position = [74 145 100 22];

            % Create Label_11
            app.Label_11 = uilabel(app.UIFigure);
            app.Label_11.HorizontalAlignment = 'right';
            app.Label_11.Position = [542 469 29 22];
            app.Label_11.Text = '日期';

            % Create datedisplay
            app.datedisplay = uitextarea(app.UIFigure);
            app.datedisplay.Editable = 'off';
            app.datedisplay.Position = [586 469 127 24];

            % Create Label_12
            app.Label_12 = uilabel(app.UIFigure);
            app.Label_12.HorizontalAlignment = 'right';
            app.Label_12.Position = [217 374 53 22];
            app.Label_12.Text = '捕虫目标';

            % Create Insect_catchinggoal
            app.Insect_catchinggoal = uidropdown(app.UIFigure);
            app.Insect_catchinggoal.Items = {'1000', '3000', '7000', '18000'};
            app.Insect_catchinggoal.ValueChangedFcn = createCallbackFcn(app, @Insect_catchinggoalValueChanged, true);
            app.Insect_catchinggoal.Position = [285 374 100 22];
            app.Insect_catchinggoal.Value = '7000';

            % Create Label_13
            app.Label_13 = uilabel(app.UIFigure);
            app.Label_13.HorizontalAlignment = 'right';
            app.Label_13.Position = [217 333 53 22];
            app.Label_13.Text = '清洁目标';

            % Create Washinggoal
            app.Washinggoal = uidropdown(app.UIFigure);
            app.Washinggoal.Items = {'1000', '3000', '7000', '18000'};
            app.Washinggoal.ValueChangedFcn = createCallbackFcn(app, @WashinggoalValueChanged, true);
            app.Washinggoal.Position = [285 333 100 22];
            app.Washinggoal.Value = '18000';

            % Create Label_14
            app.Label_14 = uilabel(app.UIFigure);
            app.Label_14.HorizontalAlignment = 'right';
            app.Label_14.Position = [217 291 53 22];
            app.Label_14.Text = '钓鱼目标';

            % Create Fishinggoal
            app.Fishinggoal = uidropdown(app.UIFigure);
            app.Fishinggoal.Items = {'1000', '3000', '7000', '18000'};
            app.Fishinggoal.ValueChangedFcn = createCallbackFcn(app, @FishinggoalValueChanged, true);
            app.Fishinggoal.Position = [285 291 100 22];
            app.Fishinggoal.Value = '18000';

            % Create Label_15
            app.Label_15 = uilabel(app.UIFigure);
            app.Label_15.HorizontalAlignment = 'right';
            app.Label_15.Position = [217 246 53 22];
            app.Label_15.Text = '采集目标';

            % Create Gathergoal
            app.Gathergoal = uidropdown(app.UIFigure);
            app.Gathergoal.Items = {'1000', '3000', '7000', '18000'};
            app.Gathergoal.ValueChangedFcn = createCallbackFcn(app, @GathergoalValueChanged, true);
            app.Gathergoal.Position = [285 246 100 22];
            app.Gathergoal.Value = '18000';

            % Create Label_16
            app.Label_16 = uilabel(app.UIFigure);
            app.Label_16.HorizontalAlignment = 'right';
            app.Label_16.Position = [6 96 53 22];
            app.Label_16.Text = '石头目标';

            % Create Stonegoal
            app.Stonegoal = uieditfield(app.UIFigure, 'numeric');
            app.Stonegoal.ValueDisplayFormat = '%.0f';
            app.Stonegoal.ValueChangedFcn = createCallbackFcn(app, @StonegoalValueChanged, true);
            app.Stonegoal.Position = [74 96 100 22];
            app.Stonegoal.Value = 430;

            % Create Label_17
            app.Label_17 = uilabel(app.UIFigure);
            app.Label_17.HorizontalAlignment = 'right';
            app.Label_17.Position = [427 236 65 22];
            app.Label_17.Text = '体力药数量';

            % Create Drgnum
            app.Drgnum = uispinner(app.UIFigure);
            app.Drgnum.Limits = [0 Inf];
            app.Drgnum.ValueChangedFcn = createCallbackFcn(app, @DrgnumValueChanged, true);
            app.Drgnum.Position = [495 236 70 22];

            % Create Label_18
            app.Label_18 = uilabel(app.UIFigure);
            app.Label_18.HorizontalAlignment = 'right';
            app.Label_18.Position = [340 195 152 22];
            app.Label_18.Text = '每日额外买体力钻数(0-700)';

            % Create Drgnum_2
            app.Drgnum_2 = uispinner(app.UIFigure);
            app.Drgnum_2.Step = 100;
            app.Drgnum_2.Limits = [0 700];
            app.Drgnum_2.ValueChangedFcn = createCallbackFcn(app, @Drgnum_2ValueChanged, true);
            app.Drgnum_2.Position = [495 195 70 22];

            % Create CatchPhysGap
            app.CatchPhysGap = uitextarea(app.UIFigure);
            app.CatchPhysGap.Editable = 'off';
            app.CatchPhysGap.Position = [742 354 75 25];

            % Create Label_19
            app.Label_19 = uilabel(app.UIFigure);
            app.Label_19.HorizontalAlignment = 'right';
            app.Label_19.Position = [613 355 29 22];
            app.Label_19.Text = '捕虫';

            % Create CatchGap
            app.CatchGap = uitextarea(app.UIFigure);
            app.CatchGap.Editable = 'off';
            app.CatchGap.Position = [657 354 75 25];

            % Create Label_20
            app.Label_20 = uilabel(app.UIFigure);
            app.Label_20.HorizontalAlignment = 'right';
            app.Label_20.Position = [613 321 29 22];
            app.Label_20.Text = '清洁';

            % Create WashingGap
            app.WashingGap = uitextarea(app.UIFigure);
            app.WashingGap.Editable = 'off';
            app.WashingGap.Position = [657 320 75 25];

            % Create Label_21
            app.Label_21 = uilabel(app.UIFigure);
            app.Label_21.HorizontalAlignment = 'right';
            app.Label_21.Position = [613 289 29 22];
            app.Label_21.Text = '钓鱼';

            % Create FishingGap
            app.FishingGap = uitextarea(app.UIFigure);
            app.FishingGap.Editable = 'off';
            app.FishingGap.Position = [657 288 75 25];

            % Create Label_22
            app.Label_22 = uilabel(app.UIFigure);
            app.Label_22.HorizontalAlignment = 'right';
            app.Label_22.Position = [613 256 29 22];
            app.Label_22.Text = '采集';

            % Create GatherGap
            app.GatherGap = uitextarea(app.UIFigure);
            app.GatherGap.Editable = 'off';
            app.GatherGap.Position = [657 255 75 25];

            % Create Label_23
            app.Label_23 = uilabel(app.UIFigure);
            app.Label_23.HorizontalAlignment = 'right';
            app.Label_23.Position = [613 222 29 22];
            app.Label_23.Text = '石头';

            % Create StoneGap
            app.StoneGap = uitextarea(app.UIFigure);
            app.StoneGap.Editable = 'off';
            app.StoneGap.Position = [657 221 75 25];

            % Create V10Label
            app.V10Label = uilabel(app.UIFigure);
            app.V10Label.FontSize = 24;
            app.V10Label.Position = [120 469 362 32];
            app.V10Label.Text = '咏叹银夜莺合成时间计算器  V1.0';

            % Create Label_25
            app.Label_25 = uilabel(app.UIFigure);
            app.Label_25.HorizontalAlignment = 'right';
            app.Label_25.Position = [640 162 65 22];
            app.Label_25.Text = '总所需体力';

            % Create PhysTotal
            app.PhysTotal = uitextarea(app.UIFigure);
            app.PhysTotal.Editable = 'off';
            app.PhysTotal.Position = [720 162 106 24];

            % Create Label_26
            app.Label_26 = uilabel(app.UIFigure);
            app.Label_26.HorizontalAlignment = 'right';
            app.Label_26.Position = [628 130 77 22];
            app.Label_26.Text = '合成所需天数';

            % Create DaysCost
            app.DaysCost = uitextarea(app.UIFigure);
            app.DaysCost.Editable = 'off';
            app.DaysCost.Position = [720 130 106 24];

            % Create Label_27
            app.Label_27 = uilabel(app.UIFigure);
            app.Label_27.HorizontalAlignment = 'right';
            app.Label_27.Position = [640 95 65 22];
            app.Label_27.Text = '合成时日期';

            % Create DateFinished
            app.DateFinished = uitextarea(app.UIFigure);
            app.DateFinished.Editable = 'off';
            app.DateFinished.Position = [720 95 106 24];

            % Create Label_29
            app.Label_29 = uilabel(app.UIFigure);
            app.Label_29.HorizontalAlignment = 'right';
            app.Label_29.Position = [640 60 65 22];
            app.Label_29.Text = '总消耗体力';

            % Create PhysTotalCost
            app.PhysTotalCost = uitextarea(app.UIFigure);
            app.PhysTotalCost.Editable = 'off';
            app.PhysTotalCost.Position = [720 60 106 24];

            % Show the figure after all components are created
            app.UIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = YinyeyingCalc

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            % Execute the startup function
            runStartupFcn(app, @startupFcn)

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end